import request from '@/utils/request';
export type AnyObject = {
  [propsName: string]: any
}
export type ContainIdObject = {
  id:string,
  [propsName: string]: any
}
export interface DataModel{
  categoryL1List:ContainIdObject[];
  categoryL2List:ContainIdObject[]
  currentCategory:ContainIdObject
  categoryGroupList: ContainIdObject[]
  categoryL1?: ContainIdObject
  categoryItems?: AnyObject
  categoryItemList?: AnyObject[],
  categoryList?: AnyObject[],
}
export interface SortModel{
  YXJSONObject:AnyObject
  global:AnyObject
  YXJSONArray:AnyObject
  data:DataModel
}
export const getSortList = () => {
  return request.get<any, SortModel>(`/item/cateList.json`)
}
export const categoryL2ListId = (categoryId:string) => {
  return request.get<any,SortModel>(`/item/cateList.json?categoryId=${categoryId}`)
}

export const worthBuyingBaneer = () => {
    return request.get<any,AnyObject>('/topic/v1/know/navWap.json')
}

export const worthBuyingList = (page:number,size:number) => {
    return request.get<any,AnyObject>(`/topic/v1/find/recAuto.json?page=${page}&size=${size}`)
}

export const categorydetail = (categoryType:string,subCategoryId:string,categoryId:string) => {
  return request.get<any, SortModel>(`/item/list.json?&categoryType=${categoryType}&subCategoryId=${subCategoryId}&categoryId=${categoryId}`)
}
export const Allcategorydetail = (categoryId:string) => {
  return request.get<any, SortModel>(`/item/list.json?&categoryId=${categoryId}`)
}